package com.edfu.core.institutemgt.persistence.entity;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import com.edfu.core.identitymgt.persistence.entity.UserEnrollmentEntity;

/**
 * 
 * @author sahsharm
 *
 */

@Entity
@Table(name="sectionmember", uniqueConstraints=@UniqueConstraint(columnNames={"section_id" , "user_id"}))
public class SectionMemberEntity implements IInstituteMgtEntity {
	private long id;
	private UserEnrollmentEntity userEnrollment;
	private SectionEntity section;
	private Date addedOn;
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	
	@ManyToOne
	@JoinColumn(name = "user_id", nullable = false)
	public UserEnrollmentEntity getUserEnrollment() {
		return userEnrollment;
	}
	public void setUserEnrollment(UserEnrollmentEntity userEnrollment) {
		this.userEnrollment = userEnrollment;
	}
	
	@ManyToOne
	@JoinColumn(name = "section_id", nullable = false)
	public SectionEntity getSection() {
		return section;
	}
	public void setSection(SectionEntity section) {
		this.section = section;
	}

	public Date getAddedOn() {
		return addedOn;
	}
	public void setAddedOn(Date addedOn) {
		this.addedOn = addedOn;
	}
}
